import Vue from "vue";
import VueRouter from "vue-router";
Vue.use(VueRouter);
import Home from "../components/Home";
import About from "../components/About";
import Message from "../components/Message";
import News from "../components/News";
import Detail from "../components/Detail";
export default new VueRouter({
  routes: [
    { path: "/home", component: Home },
    {
      path: "/about",
      component: About,
      children: [
        {
          path: "message",
          component: Message,
          children: [
            {
              path: "detail/:id/:name", 
              component: Detail,
              props($route) {
                return {
                  ...$route.params,
                };
              },
            },
          ],
        },
        { name:'News',path: "news", component: News },
        { path: "", redirect: "news" },
      ],
    },
    { path: "/", redirect: "/home" },
  ],
});
